package com.koron.operation.classes.form.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.operation.classes.form.bean.dto.ClassesFormClockIn;
import com.koron.operation.classes.form.bean.dto.ClassesFormDTO;
import com.koron.operation.classes.form.bean.dto.ClassesFormRankDTO;
import com.koron.operation.classes.form.bean.po.ClassesForm;
import com.koron.operation.classes.form.bean.query.ClassesFormQuery;
import com.koron.operation.classes.form.bean.vo.ClassesFormVO;
import com.koron.operation.classes.shift.bean.dto.ChangeShiftDTO;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.Date;
import java.util.List;

/**
 * 月度排班表(ClassesForm)表服务接口
 *
 * @author jzp
 * @since 2023-05-17 09:43:28
 */
public interface ClassesFormService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    ClassesForm getById(SessionFactory factory, String id);

    ClassesFormDTO getDtoById(SessionFactory factory, String id);

    /**
     * 获取本月本单位的排班表
     */
    ClassesForm getCurr(SessionFactory factory, String deptId, Date date);

    ClassesFormDTO getCurrDto(SessionFactory factory, String deptId, Date date);

    List<ClassesFormRankDTO> getUserListByOrgId(SessionFactory factory, String orgId);

    /**
     * 查询所有数据
     *
     * @param query 查询条件对象
     * @return 列表结果集
     */
    List<ClassesFormVO> list(SessionFactory factory, ClassesFormQuery query);

    /**
     * 分页查询
     *
     * @param query 分页条件
     * @return 对象列表
     */
    default PageInfo<ClassesFormVO> page(SessionFactory factory, PageQuery pageQuery, ClassesFormQuery query) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<ClassesFormVO> classesFormList = list(factory, query);
        return new PageInfo<>(classesFormList);
    }

    ClassesFormClockIn info(SessionFactory factory, String deptId, String account, Date date);

    ChangeShiftDTO shiftInfo(SessionFactory factory, String deptId, String rankId, Date date);

    /**
     * 新增数据
     *
     * @param classesForm 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, ClassesForm classesForm);

    boolean saveDto(SessionFactory factory, ClassesFormDTO classesFormDTO);

    /**
     * 修改数据
     *
     * @param classesForm 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, ClassesForm classesForm);

    boolean updateStatus(SessionFactory factory, String id, String status);

    boolean submit(SessionFactory factory, ClassesFormDTO classesFormDTO, String currNodeCode);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(SessionFactory factory, String id);

}
